#include "xsync.h"

/*
====================================
XSync::XSync
====================================
*/
XSync::XSync()
{
	InitializeCriticalSection(&m_cs);
}

/*
====================================
XSync::~XSync
====================================
*/
XSync::~XSync()
{
	DeleteCriticalSection(&m_cs);
}

/*
====================================
XSync::Lock
====================================
*/
void XSync::Lock()
{
	EnterCriticalSection(&m_cs);
}

/*
====================================
XSync::Unlock
====================================
*/
void XSync::Unlock()
{
	LeaveCriticalSection(&m_cs);
}

/*
====================================
XScopeSync::XScopeSync
====================================
*/
XScopeSync::XScopeSync(XSync * Obj)
{
	m_SyncObj = Obj;
	Obj->Lock();
}

/*
====================================
XScopeSync::~XScopeSync
====================================
*/
XScopeSync::~XScopeSync()
{
	m_SyncObj->Unlock();
}
